package org.cqipc.edu.service.impl;

import org.cqipc.edu.dao.Type1Dao;
import org.cqipc.edu.dao.Type2Dao;
import org.cqipc.edu.dao.Type3Dao;
import org.cqipc.edu.entity.Type1;
import org.cqipc.edu.entity.Type2;
import org.cqipc.edu.entity.Type3;
import org.cqipc.edu.service.TypeService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description: 类别服务实现
 * @ClassNmae: TypeServiceImpl
 * @Author: HeYue
 * @DateTime: 2020-11-01 15:06
 **/
@Service
@Transactional
public class TypeServiceImpl implements TypeService {

    @Resource
    private Type1Dao type1Dao;
    @Resource
    private Type2Dao type2Dao;
    @Resource
    private Type3Dao type3Dao;

    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public List<Type1> getType1List() {
        return type1Dao.queryAll();
    }


    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public List<Type2> getType2List() {
        return type2Dao.queryAll();
    }


    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public List<Type3> getType3List() {
        return type3Dao.queryAll();
    }

    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public List<Type2> getType2ListByType1Id(Integer id) {
        return type2Dao.queryBytype1d(id);
    }

    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public List<Type3> getType3ListByType2Id(Integer id) {
        return type3Dao.queryBytype2d(id);
    }
}
